/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BLL;

import DTO.Room;
import DAL.RoomDAL;
import java.sql.Date;
import java.sql.SQLException;
import java.util.ArrayList;
/**
 *
 * @author Huong Giang
 */
public class RoomBLL {
     public static boolean updateKH(Room emp) throws Exception {
        if (RoomDAL.checkRoomByMaPhong(emp.getMaPhong())) {
            return RoomDAL.updateRoom(emp);
        } else {
            return false;
        }
    }

     public static ArrayList<Room> selectRoomall() throws Exception {
        return RoomDAL.selectRoomall();
    }
    
    public static ArrayList<Room> searchRoomByMaphong(int maphong) throws Exception{
        return RoomDAL.searchRoomByMaPhong(maphong);
    }
    public static int[] SelectMaPhong() throws SQLException{
       return RoomDAL.SelectMaphong();
    }
    public static int getGia(int ma){
        return RoomDAL.getGia(ma);
    }
    public static void updateThue(int ma){
        RoomDAL.updatePhongThue(ma);
    }
    public static void updateTrong(int ma){
        RoomDAL.updatePhongTrong(ma);
    }
    public static ArrayList<Room> selectTrong(int tang) throws SQLException{
        return RoomDAL.SelectPhongTrong(tang);
    }
     public static ArrayList<Room> selectTra(int tang, Date today) throws SQLException{
        return RoomDAL.SelectPhongSaptra(tang,today);
    }
}

